package cn.swust.designpatternlearningplatform.domain.dto;


import lombok.Data;

import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;

@Data
public class PaperExportDto {
    //pdf抬头名称
    private String title;
    //试卷名称
    private String paperName;
    //题目名称
    private List<TopicDto> topicDtoList;
    //学生做题记录
    private Map<String, StudentTestRecordDto> selfRecord;
    //学生信息
    private StudentDto studentDto;
    //得分
    private Integer score;
    //总分
    private Integer totalScore;

    /**
     * 设置做题记录
     *
     * @param selfRecordList
     * @return void
     * @author Tang
     * @date 2023/10/16 0:25
     **/
    public void setSelfRecord(List<StudentTestRecordDto> selfRecordList) {
        Map<String, StudentTestRecordDto> recordDtoMap = new HashMap<>();
        for (StudentTestRecordDto studentTestRecordDto : selfRecordList) {
            recordDtoMap.put(studentTestRecordDto.getTopicId().toString(), studentTestRecordDto);
        }
        this.selfRecord = recordDtoMap;
    }

    public void setPaperName(String paperName) {
        this.paperName = paperName;
        this.title = paperName + "做题结果";
    }
}
